package my.cn.bdqn.life;

import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;

public class LoadingActivity extends Activity {
	private boolean autoLogin = false;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.loading_layout);
		SharedPreferences sp = getSharedPreferences("freelife", MODE_PRIVATE);
		String uid = sp.getString("uid", null);
		autoLogin = sp.getBoolean("auto", false);
		if (uid == null) {
			startActivity(new Intent(this, RegActivity.class));
			finish();
			return;
		}
		new Thread() {
			@Override
			public void run() {
				try {
					sleep(4000);
				} catch (InterruptedException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				} finally {
					if (autoLogin) {
						startActivity(new Intent(LoadingActivity.this,
								TabMainActivity.class));
					} else {
						startActivity(new Intent(LoadingActivity.this,
								LoginActivity.class));
					}

					finish();
				}
			}

		};
	}

}
